package com.test.aop.log;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author SN
 * @date 2020/4/18 13:11
 * @desc
 */
@Component
@Aspect
public class Logger {

    /**
     * 配置切入点
     */
    @Pointcut("execution(* com.test.service.impl.*.*(..))")
    public void pointcut(){};

    @Before("pointcut()")
    public void before(JoinPoint joinPoint){
        System.out.println("before ....");
    }

    @AfterReturning("pointcut()")
    public void afterReturning(){
        System.out.println("afterReturning ....");
    }

    @After("pointcut()")
    public void after(){
        System.out.println("after ....");
    }
//
//    @AfterThrowing(value = "pointcut()", throwing = "e")
//    public void beforeThrowing(Exception e){
//        System.out.println("beforeThrowing ....");
//    }
//
//    @Around("pointcut()")
//    public void around(ProceedingJoinPoint joinPoint){
//        System.out.println("around ....");
//    }

}